<ui:composition xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"  
	xmlns:f="http://java.sun.com/jsf/core"
	template="template/template.xhtml">
	<ui:define name="title">
		<h:outputText value="#{msgs.projects}"/>
	</ui:define>
	<ui:define name="bodyInclude">
		<ui:include src="include/menu.xhtml" />
		<p:fieldset legend="#{msgs.projects}" toggleable="true">
			<p:outputPanel layout="block" styleClass="container">
				<h:form id="projectsForm">
					<p:dataTable currentPageReportTemplate="{currentPage} #{msgs.of} {totalPages}" emptyMessage="#{msgs.emptyDataTableMessage}" id="projectsTable" paginator="true" paginatorAlwaysVisible="false" paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport}{PageLinks}{NextPageLink} {LastPageLink}" rows="10" rowsPerPageTemplate="5,10,20,50" selection="#{projectsAdministrationController.selectedProjects}" value="#{projectsAdministrationController.projects}" var="project">
						<p:column selectionMode="multiple"/>
						<p:column headerText="#{msgs.id}" sortBy="#{project.project.projectId}" styleClass="center">
							<h:outputText value="#{project.project.projectId}"/>
						</p:column>
						<p:column headerText="#{msgs.name}" sortBy="#{project.project.name}" styleClass="center">
							<h:outputText value="#{project.project.name}"/>
						</p:column>
						<p:column headerText="#{msgs.versionsNumber}" sortBy="#{project.versionsNumber}" styleClass="center">
							<h:outputText value="#{project.versionsNumber}"/>
						</p:column>
						<p:column headerText="#{msgs.lastVersion}" styleClass="center">
							<h:outputText rendered="#{null != project.lastVersion}" value="#{project.lastVersion.name}"/>
							<h:outputText rendered="#{null == project.lastVersion}" value="#{msgs.none}"/>
						</p:column>
						<p:column headerText="#{msgs.actions}" styleClass="center">
							<p:commandButton actionListener="#{projectsAdministrationController.onVersionCreation}" alt="#{msgs.addAVersion}" image="ui-icon ui-icon-circle-plus" oncomplete="dialogVersionCreationVar.show()" process="@this" update="versionCreationForm" title="#{msgs.addAVersion}">
								<f:setPropertyActionListener target="#{projectsAdministrationController.currentProject}" value="#{project.project}" />
							</p:commandButton>
						</p:column>
					</p:dataTable>
					<p:outputPanel layout="block" styleClass="buttonContainer center">
						<p:commandButton actionListener="#{projectsAdministrationController.initProjectToCreate}" image="ui-icon ui-icon-circle-plus" oncomplete="dialogProjectCreationVar.show()" process="@this" update="projectCreationForm" value="#{msgs.create}"/>
						<p:commandButton image="ui-icon ui-icon-circle-close" process="@this" value="#{msgs.delete}"/>
					</p:outputPanel>
				</h:form>
			</p:outputPanel>
		</p:fieldset>
		<ui:include src="dialog/dialogProjectCreation.xhtml" />
		<ui:include src="dialog/dialogVersionCreation.xhtml" />
	</ui:define>
</ui:composition>